#pragma once

#include <cmath>

#include "UnitGroup.h"

class Formation
{
public:
	Formation(void);

	static const int DEFAULT_INNER_DISTANCE = 40;
	enum Type {LineFormation, BoxFormation, CircleFormation, DefaultFormation};

	void goLineFormation(double facingAngle, int innerDistance);
	void goBoxFormation(double facingAngle, int width, int length, int innerDistance);
	void goCircleFormation(double facingAngle, int radius, int innerDistance);

	void rotateFormation(double facingAngle, const BWAPI::Position anchor);

	bool hasSpaceForFormation(Type type);
	
	Type type() const;
	UnitGroup*& units();

private:
	Type mType;
	UnitGroup* mUnits;
	double mFacingAngle;
	int mWidth, mLength, mRadius, mInnerDistance;
};
